﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using LCA.Utils;
using LCA.Data;

public partial class Admin_LCASystem_UpdateSystem : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            RefreshComponents();
        }
    }

    private void RefreshComponents()
    {
        //Guid? systemId = GetSystemId();
        //ctlSystemEditor.SystemId = systemId;
        ctlSystemEditor.RefreshComponents();
    }

    //private void SetSystemId(Guid? systemId)
    //{
    //    ViewState["SystemId"] = systemId;
    //    ctlSystemEditor.SystemId = systemId;

    //}

    private Guid? GetSystemId()
    {
        return StringHelper.ParseGuid(Request.Params["systemId"]);
    }

    protected void ctlSystemEditor_DataSaved(object sender, EventArgs e)
    {
        Guid id = ((EditorArgs)e).ItemId.Value;
        PageHelper.AdminPageRedirect(Page, "UpdateSystem.aspx?systemId=" + id);
    }

    protected void ctlSystemEditor_Cancelled(object sender, EventArgs e)
    {
        PageHelper.AdminPageRedirect(Page, "ManageSystems.aspx");
    }
}